package com.example.tresenrayaandroid;


import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioGroup;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		
		Button iniciar=(Button) findViewById(R.id.iniciar);
		 
		
		iniciar.setOnClickListener(new OnClickListener() {
		
			RadioGroup rgOpciones = (RadioGroup)findViewById(R.id.gruporb);
			@Override
			public void onClick(View v) {
	 
				int selectedId = rgOpciones.getCheckedRadioButtonId();
	 
				
				
				if(selectedId==R.id.radio1)
				{
					Intent i = new Intent(MainActivity.this, JugadorVsMaquina.class);
			        startActivity(i);
				}
				else if(selectedId==R.id.radio2)
				{
					Intent i = new Intent(MainActivity.this, JugadorVsJugador.class);
			        startActivity(i);
				}
	 
				
	 
			}
	 
		});
		
	        
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
